<!DOCTYPE html>
<html lang="cn">
<head>
    <title>WSD Admin</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="stylesheet" href="__STATICURL__/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/bootstrap-responsive.min.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/matrix-style.css"/>
    <link rel="stylesheet" href="__STATICURL__/css/matrix-media.css"/>
    <link href="__STATICURL__/font-awesome/css/font-awesome.css" rel="stylesheet"/>
</head>
<body>
<include file="Common:header"/>
<div id="content">
    <!--breadcrumbs-->
    <div id="content-header">
        <div id="breadcrumb"><a href="__ROOT__/clover"><i class="icon-home"></i> 主页</a>
            <a href="#" class="current">新闻分类列表</a>
        </div>
    </div>
    <!--End-breadcrumbs-->
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <a style="float:right;" href="__URL__/add_category" class=" btn-icon-pg">
                    <ul>
                        <li><i class="icon-plus"></i>添加分类</li>
                    </ul>
                </a>

                <div class="widget-box" style="margin-top:0px;">
                    <div class="widget-title"><span class="icon"> <i class="icon-th"></i> </span>
                        <h5>新闻分类列表</h5>
                    </div>
                    <div class="widget-content nopadding">
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>分类ID</th>
                                <th>分类名称</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <notempty name="category_list">
                                <foreach name="{category_list}" item="vo" key="k">
                                    <tr class="even gradeA td_{$vo.id}">
                                        <td>{$vo.id}</td>
                                        <td class="center">
                                            <notempty name="vo.p_level">
                                                <span style="padding-left:{$vo[p_level]*30}px;">{$vo.cat_name}</span>
                                                <else/>
                                                <span style="font-weight:bold;">{$vo.cat_name}</span>
                                            </notempty>
                                        </td>
                                        <td style="text-align:center ;">
                                            <a class="tip" href="__URL__/edit_category?id={$vo.id}" title="编辑">
                                                <i class="icon-pencil"></i>
                                            </a>&nbsp;&nbsp;
                                            <a data-value="{$vo.id}" class="tip J_delete" href="javascript:void(0);"
                                               title="删除">
                                                <i class="icon-remove"></i>
                                            </a>
                                        </td>
                                    </tr>
                                </foreach>
                                <else/>
                                <tr class="even gradeA td_{$vo.id}">
                                    <td>暂无数据……</td>
                                </tr>
                                </endforeach>
                            </notempty>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--Footer-part-->
<include file="Common:footer"/>
<!--end-Footer-part-->
<script src="__STATICURL__/js/jquery.min.js"></script>
<script src="__STATICURL__/js/jquery.ui.custom.js"></script>
<script src="__STATICURL__/js/bootstrap.min.js"></script>
<script src="__STATICURL__/js/matrix.js"></script>
</body>
</html>
<script type="text/javascript">
    $(document).ready(function ($) {
        $(".J_delete").click(function (event) {
            var id = $(this).attr("data-value");
            if (confirm("确定要删除吗？") == true) {
                $.post('__URL__/do_delete_category', {id: id}, function (res) {
                    if (res) {
                        //$(".td_"+id).fadeOut("slow");
                        window.location.reload();
                    } else {
                        alert("删除失败");
                    }
                });
            }
        });
    });
</script>
